package com.chuangsi.project.admin.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 合同模板表
 * </p>
 *
 * @author
 * @since 2023-03-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Agreement对象", description = "合同模板表")
@TableName("t_agreement")
public class Agreement extends Model<Agreement> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "合同模板id")
    @TableId(value = "agreement_id", type = IdType.ASSIGN_UUID)
    @NotEmpty(message = "合同模板id不能为空")
    @Size(max = 32, message = "合同模板id长度过长")
    private String agreementId;

    @ApiModelProperty(value = "合同模板名称")
    @NotEmpty(message = "合同模板名称不能为空")
    @Size(max = 50, message = "合同模板名称长度过长")
    private String agreementName;

    @ApiModelProperty(value = "客户名称")
    @NotEmpty(message = "客户名称不能为空")
    @Size(max = 30, message = "客户名称长度过长")
    private String customName;

    @ApiModelProperty(value = "客户联系方式")
    @NotEmpty(message = "客户联系方式不能为空")
    @Size(max = 30, message = "客户联系方式长度过长")
    private String customPhone;

    @ApiModelProperty(value = "销售金额")
    private BigDecimal money;

    @ApiModelProperty(value = "产品类型（1.原厂代销，2.其他代销，3.传统）")
    @NotEmpty(message = "产品类型（1.原厂代销，2.其他代销，3.传统）不能为空")
    @Size(max = 1, message = "产品类型（1.原厂代销，2.其他代销，3.传统）长度过长")
    private String type;

    @ApiModelProperty(value = "支付类型（1.全款，2.分期）")
    @NotEmpty(message = "支付类型（1.全款，2.分期）不能为空")
    @Size(max = 1, message = "支付类型（1.全款，2.分期）长度过长")
    private String payType;

    @ApiModelProperty(value = "合同详情")
    @NotEmpty(message = "合同详情不能为空")
    @Size(max = 500, message = "合同详情长度过长")
    private String agreementDetail;

    @ApiModelProperty(value = "自定义字段（json格式）")
    @NotEmpty(message = "自定义字段（json格式）不能为空")
    private String selfField;

    @ApiModelProperty(value = "用户id")
    @NotNull(message = "用户id不能为空")
    private Long userId;

    @ApiModelProperty(value = "审核状态（1.待审核，2.通过，3.已驳回）")
    @NotEmpty(message = "审核状态（1.待审核，2.通过，3.已驳回）不能为空")
    @Size(max = 1, message = "审核状态（1.待审核，2.通过，3.已驳回）长度过长")
    private String appStatus;


    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "创建时间不能为空")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "修改时间不能为空")
    private LocalDateTime updateTime;


    @Override
    public Serializable pkVal() {
        return this.agreementId;
    }

}
